﻿using System;
using System.Reflection;

namespace Dora.Interception
{
    /// <summary>
    /// 代表拦截注册相关的信息
    /// </summary>
    public class InterceptorRegistration
    {
        /// <summary>
        /// 拦截类型
        /// </summary>
        public Type InterceptorType { get; }

        /// <summary>
        /// 要拦截的目标方法
        /// </summary>
        public MethodInfo Target { get; }

        /// <summary>
        /// 拦截器在拦截链中的位置
        /// </summary>
        public int Order { get; }


        public InterceptorRegistration(Type interceptorType, MethodInfo target, int order)
        {
            InterceptorType = interceptorType ?? throw new ArgumentNullException(nameof(interceptorType));
            Target = target ?? throw new ArgumentNullException(nameof(target));
            Order = order;
        }
    }
}
